package com.cci.kangdao.ecjv.controller;

import com.cci.kangdao.dto.BaseResponse;
import com.cci.kangdao.ecjv.dto.ECJVServiceStationDto;
import com.cci.kangdao.ecjv.service.ECJVServiceStationService;
import com.cci.kangdao.service.impl.SMSEnum;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @description: ecjv服务站信息
 * @author: 商伟
 * @company: CTY
 * @since: 2022/10/24 13:56
 * @version: V1.0
 **/
@RestController
@RequestMapping("/ecjvServiceStation")
public class ECJVServiceStationController {

    @Resource
    private ECJVServiceStationService ecjvServiceStationService;

    /**
     * 查询ecjv服务站信息
     * @param ecjvServiceStationDto
     * @return
     */
    @RequestMapping(value = "getPageList.aspx")
    public BaseResponse getPageList(ECJVServiceStationDto ecjvServiceStationDto) {
        if(StringUtils.isBlank(ecjvServiceStationDto.getPositionLat()) || StringUtils.isBlank(ecjvServiceStationDto.getPositionLon())){
            return BaseResponse.error(SMSEnum.type17.getIndex(), "参数不能为空");
        }
        if(null == ecjvServiceStationDto.getPage()){
            ecjvServiceStationDto.setPage(1);
        }
        if(null == ecjvServiceStationDto.getPageSize()){
            ecjvServiceStationDto.setPageSize(20);
        }
        List<ECJVServiceStationDto> list = ecjvServiceStationService.getPageList(ecjvServiceStationDto);
        return BaseResponse.success(list);
    }


}
